<!DOCTYPE html>
<html>

  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="Cache-Control" content="no-siteapp" />

    <title>xmake v2.3.4 发布, 更加完善的工具链支持</title>
    <meta name="description" content="为了让xmake更好得支持交叉编译，这个版本我重构了整个工具链，使得工具链的切换更加的方便快捷，并且现在用户可以很方便地在xmake.lua中扩展自己的工具链。关于平台的支持上，我们新增了对*BSD系统的支持，另外，此版本还新增了一个ninja主题风格，实现类似ninja的编译进度显示，例如：  项目源码  官方文档">

    
    <meta name="keywords" content="xmake,lua,C/C++,toolchains,交叉编译,tboox" /> 

    <!-- qq oauth -->
    <meta property="qc:admins" content="5211601217706727767255" />

    <!--icon -->
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
    <link rel="icon" sizes="192x192" href="/static/img/nice-highres.png" />
	<link rel="apple-touch-icon-precomposed" href="/static/img/apple-touch-icon-57x57-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="72x72" href="/static/img/apple-touch-icon-72x72-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="114x114" href="/static/img/apple-touch-icon-114x114-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/static/img/apple-touch-icon-144x144-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="180x180" href="/static/img/retinahd_icon.png" />
	<meta name="msapplication-TileImage" content="/static/img/retinahd_icon.png" />
	
    <link rel="stylesheet" href=" /css/fontawesome/css/font-awesome.min.css ">
    <link rel="stylesheet" href=" /css/main.css ">
    <link rel="canonical" href="https://tboox.org/cn/2020/06/05/xmake-update-v2.3.4/">
    <link rel="alternate" type="application/rss+xml" title="TBOOX Open Source Project" href="https://tboox.org/feed.xml ">
    <link rel="alternate" hreflang="en" href="https://tboox.org/" />
    <link rel="alternate" hreflang="zh-Hans" href="https://tboox.org/cn/" />

    <!-- css -->
    <link href="/css/reward.css" rel="stylesheet" type="text/css"> 




    <script type="text/javascript">
    function isPC(){    
        var userAgentInfo = navigator.userAgent;  
        var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod");    
        var flag = true;    
        for (var v = 0; v < Agents.length; v++) {    
            if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; }    
        }    
        return flag;    
    }
    </script>

<!-- baidu ads -->



    <!-- baidu ads -->

</head>


  <body>

    <header id="top">
    <div class="wrapper">
        <a href="/cn" class="brand">TBOOX</a>
        <button id="headerMenu" class="menu"><i class="fa fa-bars"></i></button>
        <nav id="headerNav">
            <ul>
                <li>
                    
                    <a href="/?lang=0">
                    
                        <i class="fa fa-home"></i>English
                    </a>
                </li>

                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/project/">
                            
                        
                            <i class="fa fa-bookmark"></i>项目
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/archive/">
                            
                        
                            <i class="fa fa-archive"></i>归档
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/category/">
                            
                        
                            <i class="fa fa-th-list"></i>分类
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/tag/">
                            
                        
                            <i class="fa fa-tags"></i>标记
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/docs/">
                            
                        
                            <i class="fa fa-book"></i>文档
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="https://xmake.io/#/zh-cn/about/contact" target="_blank" >
                            
                        
                            <i class="fa fa-forumbee"></i>社区
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/donation/">
                            
                        
                            <i class="fa fa-heart"></i>捐助
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/about/">
                            
                        
                            <i class="fa fa-user"></i>关于
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                    
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            </ul>
        </nav>
    </div>
</header>



        <div class="page clearfix" post>
    <div class="left">
        <h1>xmake v2.3.4 发布, 更加完善的工具链支持</h1>
        <div class="label">

            <div class="label-card">
                <i class="fa fa-calendar"></i>2020-06-05
            </div>

            <div class="label-card">
                
            </div>

            <div class="label-card">
                
            </div>

            <div class="label-card">
            


<!-- <span class="point">•</span> -->
<span class="categories">
  <i class="fa fa-th-list"></i>
  
    
        <a href="/category/#xmake" title="Category: xmake" rel="category">xmake</a>
    
  

  <!-- <span class="point">•</span> -->
</span>


            </div>

            <div class="label-card">
            
<!-- <span class="point">•</span> -->
<span class="pageTag">
  <i class="fa fa-tags"></i>
  
    
        <!--a href="/tag/#xmake" title="Tag: xmake" rel="tag">xmake</a-->
        <a href="/cn/tag/#xmake" title="Tag: xmake" rel="tag">xmake</a>&nbsp;
    
        <!--a href="/tag/#lua" title="Tag: lua" rel="tag">lua</a-->
        <a href="/cn/tag/#lua" title="Tag: lua" rel="tag">lua</a>&nbsp;
    
        <!--a href="/tag/#C%2FC%2B%2B" title="Tag: C/C++" rel="tag">C/C++</a-->
        <a href="/cn/tag/#C/C++" title="Tag: C/C++" rel="tag">C/C++</a>&nbsp;
    
        <!--a href="/tag/#toolchains" title="Tag: toolchains" rel="tag">toolchains</a-->
        <a href="/cn/tag/#toolchains" title="Tag: toolchains" rel="tag">toolchains</a>&nbsp;
    
        <!--a href="/tag/#%E4%BA%A4%E5%8F%89%E7%BC%96%E8%AF%91" title="Tag: 交叉编译" rel="tag">交叉编译</a-->
        <a href="/cn/tag/#交叉编译" title="Tag: 交叉编译" rel="tag">交叉编译</a>
    
  

</span>

            </div>

        </div>
        <hr>
        <article itemscope itemtype="http://schema.org/BlogPosting">
        <p>为了让xmake更好得支持交叉编译，这个版本我重构了整个工具链，使得工具链的切换更加的方便快捷，并且现在用户可以很方便地在xmake.lua中扩展自己的工具链。</p>

<p>关于平台的支持上，我们新增了对*BSD系统的支持，另外，此版本还新增了一个ninja主题风格，实现类似ninja的编译进度显示，例如：</p>

<p><img src="https://xmake.io/assets/img/theme/ninja.png" width="60%" /></p>

<ul>
  <li><a href="https://github.com/xmake-io/xmake">项目源码</a></li>
  <li><a href="https://xmake.io/#/zh-cn/">官方文档</a></li>
</ul>

<h2 id="新特性介绍">新特性介绍</h2>

<h3 id="工具链改进">工具链改进</h3>

<h4 id="工具链和平台完全分离">工具链和平台完全分离</h4>

<p>之前的版本，平台和工具链绑定的过于紧密，例如<code class="highlighter-rouge">xmake f -p windows</code> 平台，默认只能使用msvc的编译，想要切到clang或者其他编译器，就只能走交叉编译平台：<code class="highlighter-rouge">xmake f -p cross</code>。</p>

<p>但是这样的话，一些windows平台特有的设置就丢失了，而且用户也没法使用<code class="highlighter-rouge">if is_plat("windows") then</code>来判断windows平台做特定的设置。</p>

<p>其实平台和工具链是完全可以独立开来的，新版本经过重构后，即使是windows平台以及其他任何平台，也可以方便快速的切换到clang, llvm等其他工具链。</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake f -p windows --toolchain<span class="o">=</span>clang
</code></pre>
</div>

<h4 id="内置工具链">内置工具链</h4>

<p>虽然xmake的交叉编译配置支持所有工具链，也提供一定程度的智能分析和工具链探测，但通用方案多少对特定工具链支持需要追加各种额外的配置，例如额外传递一些<code class="highlighter-rouge">--ldflags=</code>, <code class="highlighter-rouge">--cxflags=</code>参数什么的。</p>

<p>而新版本xmake内置了一些常用工具链，可以省去交叉编译工具链复杂的配置过程，只需要传递工具链名到<code class="highlighter-rouge">--toolchain=xxx</code>即可。</p>

<p>切换到llvm工具链：</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake f -p cross --toolchain<span class="o">=</span>llvm --sdk<span class="o">=</span><span class="s2">"C:</span><span class="se">\P</span><span class="s2">rogram Files</span><span class="se">\L</span><span class="s2">LVM"</span>
<span class="gp">$ </span>xmake
</code></pre>
</div>

<p>切换到GNU-RM工具链：</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake f -p cross --toolchain<span class="o">=</span>gnu-rm --sdk<span class="o">=</span>/xxx/cc-arm-none-eabi-9-2019-q4-major
<span class="gp">$ </span>xmake
</code></pre>
</div>

<p>就可以快速切换的指定的交叉编译工具链，对于内置的工具链，可以省去大部分配置，通常只需要<code class="highlighter-rouge">--toolchain=</code>和<code class="highlighter-rouge">--sdk=</code>即可，其他的配置都会自动设置好，确保编译正常。</p>

<p>那xmake还支持哪些内置工具链呢？我们可以通过下面的命令查看：</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake show -l toolchains
xcode         Xcode IDE
vs            VisualStudio IDE
yasm          The Yasm Modular Assembler
clang         A C language family frontend <span class="k">for </span>LLVM
go            Go Programming Language Compiler
dlang         D Programming Language Compiler
sdcc          Small Device C Compiler
cuda          CUDA Toolkit
ndk           Android NDK
rust          Rust Programming Language Compiler
llvm          A collection of modular and reusable compiler and toolchain technologies
cross         Common cross compilation toolchain
nasm          NASM Assembler
gcc           GNU Compiler Collection
mingw         Minimalist GNU <span class="k">for </span>Windows
gnu-rm        GNU Arm Embedded Toolchain
envs          Environment variables toolchain
fasm          Flat Assembler
</code></pre>
</div>

<h4 id="工具链的同步切换">工具链的同步切换</h4>

<p>新版本xmake还支持工具链的完整同步切换，这个是什么意思呢？</p>

<p>比如，我们要从默认的gcc切换到clang编译，可能需要切一些工具集，<code class="highlighter-rouge">xmake f --cc=clang --cxx=clang --ld=clang++ --sh=clang++</code>，因为编译器切了，对应的链接器，静态库归档器什么的都得同时切才行。</p>

<p>这么挨个切一边，确实很蛋疼，作者本人也是受不了了，所以重构工具链的时候，这块也重点改进了下，现在只需要：</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake f --toolchain<span class="o">=</span>clang
<span class="gp">$ </span>xmake
</code></pre>
</div>

<p>就可以完全把所有clang工具集整体切过去，那如何重新切回gcc呢，也很方便：</p>

<p>或者</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake f --toolchain<span class="o">=</span>gcc
<span class="gp">$ </span>xmake
</code></pre>
</div>

<h4 id="自定义工具链">自定义工具链</h4>

<p>另外，我们现在也可以在xmake.lua中自定义toolchain，然后通过<code class="highlighter-rouge">xmake f --toolchain=myclang</code>指定切换，例如：</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">toolchain</span><span class="p">(</span><span class="s2">"myclang"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"standalone"</span><span class="p">)</span>
    <span class="n">set_toolset</span><span class="p">(</span><span class="s2">"cc"</span><span class="p">,</span> <span class="s2">"clang"</span><span class="p">)</span>
    <span class="n">set_toolset</span><span class="p">(</span><span class="s2">"cxx"</span><span class="p">,</span> <span class="s2">"clang"</span><span class="p">,</span> <span class="s2">"clang++"</span><span class="p">)</span>
    <span class="n">set_toolset</span><span class="p">(</span><span class="s2">"ld"</span><span class="p">,</span> <span class="s2">"clang++"</span><span class="p">,</span> <span class="s2">"clang"</span><span class="p">)</span>
    <span class="n">set_toolset</span><span class="p">(</span><span class="s2">"sh"</span><span class="p">,</span> <span class="s2">"clang++"</span><span class="p">,</span> <span class="s2">"clang"</span><span class="p">)</span>
    <span class="n">set_toolset</span><span class="p">(</span><span class="s2">"ar"</span><span class="p">,</span> <span class="s2">"ar"</span><span class="p">)</span>
    <span class="n">set_toolset</span><span class="p">(</span><span class="s2">"ex"</span><span class="p">,</span> <span class="s2">"ar"</span><span class="p">)</span>
    <span class="n">set_toolset</span><span class="p">(</span><span class="s2">"strip"</span><span class="p">,</span> <span class="s2">"strip"</span><span class="p">)</span>
    <span class="n">set_toolset</span><span class="p">(</span><span class="s2">"mm"</span><span class="p">,</span> <span class="s2">"clang"</span><span class="p">)</span>
    <span class="n">set_toolset</span><span class="p">(</span><span class="s2">"mxx"</span><span class="p">,</span> <span class="s2">"clang"</span><span class="p">,</span> <span class="s2">"clang++"</span><span class="p">)</span>
    <span class="n">set_toolset</span><span class="p">(</span><span class="s2">"as"</span><span class="p">,</span> <span class="s2">"clang"</span><span class="p">)</span>

    <span class="c1">-- ...</span>
</code></pre>
</div>

<p>其中<code class="highlighter-rouge">set_toolset</code>用于挨个设置不同的工具集，比如编译器、链接器、汇编器等。</p>

<p>xmake默认会从<code class="highlighter-rouge">xmake f --sdk=xx</code>的sdk参数中去探测工具，当然我们也可以在xmake.lua中对每个自定义工具链调用<code class="highlighter-rouge">set_sdk("/xxx/llvm")</code>来写死工具链sdk地址。</p>

<p>关于这块的详情介绍，可以到<a href="https://xmake.io/zh-cn/manual/custom_toolchain">自定义工具链</a>章节查看</p>

<p>更多详情见：<a href="https://github.com/xmake-io/xmake/issues/780">#780</a></p>

<h4 id="针对特定target设置工具链">针对特定target设置工具链</h4>

<p>除了自定义工具链，我们也可以对某个特定的target单独切换设置不同的工具链，和set_toolset不同的是，此接口是对完整工具链的整体切换，比如cc/ld/sh等一系列工具集。</p>

<p>这也是推荐做法，因为像gcc/clang等大部分编译工具链，编译器和链接器都是配套使用的，要切就得整体切，单独零散的切换设置会很繁琐。</p>

<p>比如我们切换test目标到clang+yasm两个工具链：</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">)</span>
    <span class="n">set_toolchains</span><span class="p">(</span><span class="s2">"clang"</span><span class="p">,</span> <span class="s2">"yasm"</span><span class="p">)</span>
</code></pre>
</div>

<p>或者可以通过<code class="highlighter-rouge">set_toolset</code>来对每个target的工具链中的特定工具单独设置。</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">set_toolset</span><span class="p">(</span><span class="s2">"cxx"</span><span class="p">,</span> <span class="s2">"clang"</span><span class="p">)</span>
    <span class="n">set_toolset</span><span class="p">(</span><span class="s2">"ld"</span><span class="p">,</span> <span class="s2">"clang++"</span><span class="p">)</span>
</code></pre>
</div>

<h3 id="ninja构建主题">ninja构建主题</h3>

<p>构建进度风格类似ninja，采用单行进度条，不再回滚进度，用户可以根据自己的喜好设置。</p>

<p>除了进度展示不同外，其他都跟默认主题的配置相同。</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake g --theme<span class="o">=</span>ninja
</code></pre>
</div>

<p><img src="https://xmake.io/assets/img/theme/ninja.png" width="60%" /></p>

<h3 id="设置构建行为策略">设置构建行为策略</h3>

<p>xmake有很多的默认行为，比如：自动检测和映射flags、跨target并行构建等，虽然提供了一定的智能化处理，但重口难调，不一定满足所有的用户的使用习惯和需求。</p>

<p>因此，从v2.3.4开始，xmake提供默认构建策略的修改设置，开放给用户一定程度上的可配置性。</p>

<p>使用方式如下：</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">set_policy</span><span class="p">(</span><span class="s2">"check.auto_ignore_flags"</span><span class="p">,</span> <span class="kc">false</span><span class="p">)</span>
</code></pre>
</div>

<p>只需要在项目根域设置这个配置，就可以禁用flags的自动检测和忽略机制，另外<code class="highlighter-rouge">set_policy</code>也可以针对某个特定的target局部生效。</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_policy</span><span class="p">(</span><span class="s2">"check.auto_ignore_flags"</span><span class="p">,</span> <span class="kc">false</span><span class="p">)</span>
</code></pre>
</div>

<p>!&gt; 另外，如果设置的策略名是无效的，xmake也会有警告提示。</p>

<p>如果要获取当前xmake支持的所有策略配置列表和描述，可以执行下面的命令：</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake l core.project.policy.policies
<span class="o">{</span> 
  <span class="s2">"check.auto_map_flags"</span> <span class="o">=</span> <span class="o">{</span> 
    <span class="nb">type</span> <span class="o">=</span> <span class="s2">"boolean"</span>,
    description <span class="o">=</span> <span class="s2">"Enable map gcc flags to the current compiler and linker automatically."</span>,
    default <span class="o">=</span> <span class="nb">true</span> 
  <span class="o">}</span>,
  <span class="s2">"build.across_targets_in_parallel"</span> <span class="o">=</span> <span class="o">{</span> 
    <span class="nb">type</span> <span class="o">=</span> <span class="s2">"boolean"</span>,
    description <span class="o">=</span> <span class="s2">"Enable compile the source files for each target in parallel."</span>,
    default <span class="o">=</span> <span class="nb">true</span> 
  <span class="o">}</span>,
  <span class="s2">"check.auto_ignore_flags"</span> <span class="o">=</span> <span class="o">{</span> 
    <span class="nb">type</span> <span class="o">=</span> <span class="s2">"boolean"</span>,
    description <span class="o">=</span> <span class="s2">"Enable check and ignore unsupported flags automatically."</span>,
    default <span class="o">=</span> <span class="nb">true</span> 
  <span class="o">}</span> 
<span class="o">}</span>
</code></pre>
</div>

<h4 id="checkauto_ignore_flags">check.auto_ignore_flags</h4>

<p>xmake默认会对所有<code class="highlighter-rouge">add_cxflags</code>, <code class="highlighter-rouge">add_ldflags</code>接口设置的原始flags进行自动检测，如果检测当前编译器和链接器不支持它们，就会自动忽略。</p>

<p>这通常是很有用的，像一些可选的编译flags，即使不支持也能正常编译，但是强行设置上去，其他用户在编译的时候，有可能会因为编译器的支持力度不同，出现一定程度的编译失败。</p>

<p>但，由于自动检测并不保证100%可靠，有时候会有一定程度的误判，所以某些用户并不喜欢这个设定（尤其是针对交叉编译工具链，更容易出现失败）。</p>

<p>目前，v2.3.4版本如果检测失败，会有警告提示避免用户莫名躺坑，例如：</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code>warning: add_ldflags<span class="o">(</span><span class="s2">"-static"</span><span class="o">)</span> is ignored, please pass <span class="sb">`</span><span class="o">{</span>force <span class="o">=</span> <span class="nb">true</span><span class="o">}</span><span class="sb">`</span> or call <span class="sb">`</span>set_policy<span class="o">(</span><span class="s2">"check.auto_ignore_flags"</span>, <span class="nb">false</span><span class="o">)</span><span class="sb">`</span> <span class="k">if </span>you want to <span class="nb">set </span>it.
</code></pre>
</div>

<p>根据提示，我们可以自己分析判断，是否需要强制设置这个flags，一种就是通过：</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_ldflags</span><span class="p">(</span><span class="s2">"-static"</span><span class="p">,</span> <span class="p">{</span><span class="n">force</span> <span class="o">=</span> <span class="kc">true</span><span class="p">})</span>
</code></pre>
</div>

<p>来显示的强制设置上它，跳过自动检测，这对于偶尔的flags失败，是很有效快捷的处理方式，但是对于交叉编译时候，一堆的flags设置检测不过的情况下，每个都设置force太过于繁琐。</p>

<p>这个时候，我们就可以通过<code class="highlighter-rouge">set_policy</code>来对某个target或者整个project直接禁用默认的自动检测行为：</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">set_policy</span><span class="p">(</span><span class="s2">"check.auto_ignore_flags"</span><span class="p">,</span> <span class="kc">false</span><span class="p">)</span>
<span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">add_ldflags</span><span class="p">(</span><span class="s2">"-static"</span><span class="p">)</span>
</code></pre>
</div>

<p>然后我们就可以随意设置各种原始flags，xmake不会去自动检测和忽略他们了。</p>

<h4 id="checkauto_map_flags">check.auto_map_flags</h4>

<p>这是xmake的另外一个对flags的智能分析处理，通常像<code class="highlighter-rouge">add_links</code>, <code class="highlighter-rouge">add_defines</code>这种xmake内置的api去设置的配置，是具有跨平台特性的，不同编译器平台会自动处理成对应的原始flags。</p>

<p>但是，有些情况，用户还是需要自己通过add_cxflags, add_ldflags设置原始的编译链接flags，这些flags并不能很好的跨编译器</p>

<p>就拿<code class="highlighter-rouge">-O0</code>的编译优化flags来说，虽然有<code class="highlighter-rouge">set_optimize</code>来实现跨编译器配置，但如果用户直接设置<code class="highlighter-rouge">add_cxflags("-O0")</code>呢？gcc/clang下可以正常处理，但是msvc下就不支持了</p>

<p>也许我们能通过<code class="highlighter-rouge">if is_plat() then</code>来分平台处理，但很繁琐，因此xmake内置了flags的自动映射功能。</p>

<p>基于gcc flags的普及性，xmake采用gcc的flags命名规范，对其根据不同的编译实现自动映射，例如：</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_cxflags</span><span class="p">(</span><span class="s2">"-O0"</span><span class="p">)</span>
</code></pre>
</div>

<p>这一行设置，在gcc/clang下还是<code class="highlighter-rouge">-O0</code>，但如果当前是msvc编译器，那边会自动映射为msvc对应<code class="highlighter-rouge">-Od</code>编译选项来禁用优化。</p>

<p>整个过程，用户是完全无感知的，直接执行xmake就可以跨编译器完成编译。</p>

<p>!&gt; 当然，目前的自动映射实现还不是很成熟，没有100%覆盖所有gcc的flags，所以还是有不少flags是没去映射的。</p>

<p>也有部分用户并不喜欢这种自动映射行为，那么我们可以通过下面的设置完全禁用这个默认的行为：</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code>set_policy<span class="o">(</span><span class="s2">"check.auto_map_flags"</span>, <span class="nb">false</span><span class="o">)</span>
</code></pre>
</div>

<h4 id="buildacross_targets_in_parallel">build.across_targets_in_parallel</h4>

<p>这个策略也是默认开启的，主要用于跨target间执行并行构建，v2.3.3之前的版本，并行构建只能针对单个target内部的所有源文件，
跨target的编译，必须要要等先前的target完全link成功，才能执行下一个target的编译，这在一定程度上会影响编译速度。</p>

<p>然而每个target的源文件是可以完全并行化处理的，最终在一起执行link过程，v2.3.3之后的版本通过这个优化，构建速度提升了30%。</p>

<p>当然，如果有些特殊的target里面的构建源文件要依赖先前的target（尤其是一些自定义rules的情况，虽然很少遇到），我们也可以通过下面的设置禁用这个优化行为：</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code>set_policy<span class="o">(</span><span class="s2">"build.across_targets_in_parallel"</span>, <span class="nb">false</span><span class="o">)</span>
</code></pre>
</div>

<h3 id="新增编译模式">新增编译模式</h3>

<h4 id="modereleasedbg">mode.releasedbg</h4>

<p>为当前工程xmake.lua添加releasedbg编译模式的配置规则，例如：</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_rules</span><span class="p">(</span><span class="s2">"mode.releasedbg"</span><span class="p">)</span>
</code></pre>
</div>

<p>!&gt; 与release模式相比，此模式还会额外开启调试符号，这通常是非常有用的。</p>

<p>相当于：</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="k">if</span> <span class="n">is_mode</span><span class="p">(</span><span class="s2">"releasedbg"</span><span class="p">)</span> <span class="k">then</span>
    <span class="n">set_symbols</span><span class="p">(</span><span class="s2">"debug"</span><span class="p">)</span>
    <span class="n">set_optimize</span><span class="p">(</span><span class="s2">"fastest"</span><span class="p">)</span>
    <span class="n">set_strip</span><span class="p">(</span><span class="s2">"all"</span><span class="p">)</span>
<span class="k">end</span>
</code></pre>
</div>

<p>我们可以通过：<code class="highlighter-rouge">xmake f -m releasedbg</code>来切换到此编译模式。</p>

<h4 id="modeminsizerel">mode.minsizerel</h4>

<p>为当前工程xmake.lua添加minsizerel编译模式的配置规则，例如：</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_rules</span><span class="p">(</span><span class="s2">"mode.minsizerel"</span><span class="p">)</span>
</code></pre>
</div>

<p>!&gt; 与release模式相比，此模式更加倾向于最小代码编译优化，而不是速度优先。</p>

<p>相当于：</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="k">if</span> <span class="n">is_mode</span><span class="p">(</span><span class="s2">"minsizerel"</span><span class="p">)</span> <span class="k">then</span>
    <span class="n">set_symbols</span><span class="p">(</span><span class="s2">"hidden"</span><span class="p">)</span>
    <span class="n">set_optimize</span><span class="p">(</span><span class="s2">"smallest"</span><span class="p">)</span>
    <span class="n">set_strip</span><span class="p">(</span><span class="s2">"all"</span><span class="p">)</span>
<span class="k">end</span>
</code></pre>
</div>

<p>我们可以通过：<code class="highlighter-rouge">xmake f -m minsizerel</code>来切换到此编译模式。</p>

<h3 id="显示指定信息和列表">显示指定信息和列表</h3>

<h4 id="显示xmake自身和当前项目的基础信息">显示xmake自身和当前项目的基础信息</h4>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake show
The information of xmake:
    version: 2.3.3+202006011009
    host: macosx/x86_64
    programdir: /Users/ruki/.local/share/xmake
    programfile: /Users/ruki/.local/bin/xmake
    globaldir: /Users/ruki/.xmake
    tmpdir: /var/folders/32/w9cz0y_14hs19lkbs6v6_fm80000gn/T/.xmake501/200603
    workingdir: /Users/ruki/projects/personal/tbox
    packagedir: /Users/ruki/.xmake/packages
    packagedir<span class="o">(</span>cache<span class="o">)</span>: /Users/ruki/.xmake/cache/packages/2006

The information of project: tbox
    version: 1.6.5
    plat: macosx
    arch: x86_64
    mode: release
    buildir: build
    configdir: /Users/ruki/projects/personal/tbox/.xmake/macosx/x86_64
    projectdir: /Users/ruki/projects/personal/tbox
    projectfile: /Users/ruki/projects/personal/tbox/xmake.lua
</code></pre>
</div>

<h4 id="显示工具链列表">显示工具链列表</h4>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake show -l toolchains
xcode         Xcode IDE
vs            VisualStudio IDE
yasm          The Yasm Modular Assembler
clang         A C language family frontend <span class="k">for </span>LLVM
...
</code></pre>
</div>

<h4 id="显示指定target配置信息">显示指定target配置信息</h4>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake show --target<span class="o">=</span>tbox
The information of target<span class="o">(</span>tbox<span class="o">)</span>:
    kind: static
    targetfile: build/macosx/x86_64/release/libtbox.a
    rules: mode.release, mode.debug, mode.profile, mode.coverage
    options: info, float, wchar, exception, force-utf8, deprecated, xml, zip, <span class="nb">hash</span>, regex, coroutine, object, charset, database
    packages: mbedtls, polarssl, openssl, pcre2, pcre, zlib, mysql, sqlite3
    links: pthread
    syslinks: pthread, dl, m, c
    cxflags: -Wno-error<span class="o">=</span>deprecated-declarations, -fno-strict-aliasing, -Wno-error<span class="o">=</span>expansion-to-defined, -fno-stack-protector
    defines: __tb_small__, <span class="nv">__tb_prefix__</span><span class="o">=</span><span class="s2">"tbox"</span>
    mxflags: -Wno-error<span class="o">=</span>deprecated-declarations, -fno-strict-aliasing, -Wno-error<span class="o">=</span>expansion-to-defined
    headerfiles: src/<span class="o">(</span>tbox/<span class="k">**</span>.h<span class="o">)</span>|<span class="k">**</span>/impl/<span class="k">**</span>.h, src/<span class="o">(</span>tbox/prefix/<span class="k">**</span>/prefix.S<span class="o">)</span>, src/<span class="o">(</span>tbox/math/impl/<span class="k">*</span>.h<span class="o">)</span>, src/<span class="o">(</span>tbox/utils/impl/<span class="k">*</span>.h<span class="o">)</span>, build/macosx/x86_64/release/tbox.config.h
    includedirs: src, build/macosx/x86_64/release
    at: /Users/ruki/projects/personal/tbox/src/tbox/xmake.lua
    sourcebatch<span class="o">(</span>cc<span class="o">)</span>: with rule<span class="o">(</span>c.build<span class="o">)</span>
      -&gt; src/tbox/string/static_string.c
         -&gt; build/.objs/tbox/macosx/x86_64/release/src/tbox/string/static_string.c.o
         -&gt; build/.deps/tbox/macosx/x86_64/release/src/tbox/string/static_string.c.o.d
      -&gt; src/tbox/platform/sched.c
         -&gt; build/.objs/tbox/macosx/x86_64/release/src/tbox/platform/sched.c.o
         -&gt; build/.deps/tbox/macosx/x86_64/release/src/tbox/platform/sched.c.o.d
      -&gt; src/tbox/stream/stream.c
         -&gt; build/.objs/tbox/macosx/x86_64/release/src/tbox/stream/stream.c.o
         -&gt; build/.deps/tbox/macosx/x86_64/release/src/tbox/stream/stream.c.o.d
      -&gt; src/tbox/utils/base32.c
         -&gt; build/.objs/tbox/macosx/x86_64/release/src/tbox/utils/base32.c.o
         -&gt; build/.deps/tbox/macosx/x86_64/release/src/tbox/utils/base32.c.o.d
</code></pre>
</div>

<h4 id="显示内置编译模式列表">显示内置编译模式列表</h4>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake show -l modes
</code></pre>
</div>

<h4 id="显示内置编译规则列表">显示内置编译规则列表</h4>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake show -l rules
</code></pre>
</div>

<h4 id="显示其他信息">显示其他信息</h4>

<p>还在完善中，详情见：https://github.com/xmake-io/xmake/issues/798</p>

<p>或者运行：</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake show --help
</code></pre>
</div>

<h2 id="更新内容">更新内容</h2>

<h3 id="新特性">新特性</h3>

<ul>
  <li><a href="https://github.com/xmake-io/xmake/issues/630">#630</a>: 支持*BSD系统，例如：FreeBSD, ..</li>
  <li>添加wprint接口去显示警告信息</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/784">#784</a>: 添加<code class="highlighter-rouge">set_policy()</code>去设置修改一些内置的策略，比如：禁用自动flags检测和映射</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/780">#780</a>: 针对target添加set_toolchains/set_toolsets实现更完善的工具链设置，并且实现platform和toolchains分离</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/798">#798</a>: 添加<code class="highlighter-rouge">xmake show</code>插件去显示xmake内置的各种信息</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/797">#797</a>: 添加ninja主题风格，显示ninja风格的构建进度条，<code class="highlighter-rouge">xmake g --theme=ninja</code></li>
  <li><a href="https://github.com/xmake-io/xmake/issues/816">#816</a>: 添加mode.releasedbg和mode.minsizerel编译模式规则</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/819">#819</a>: 支持ansi/vt100终端字符控制</li>
</ul>

<h3 id="改进">改进</h3>

<ul>
  <li><a href="https://github.com/xmake-io/xmake/issues/771">#771</a>: 检测includedirs,linkdirs和frameworkdirs的输入有效性</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/774">#774</a>: <code class="highlighter-rouge">xmake f --menu</code>可视化配置菜单支持窗口大小Resize调整</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/782">#782</a>: 添加add_cxflags等配置flags自动检测失败提示</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/808">#808</a>: 生成cmakelists插件增加对add_frameworks的支持</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/820">#820</a>: 支持独立的工作目录和构建目录，保持项目目录完全干净</li>
</ul>

<h3 id="bugs修复">Bugs修复</h3>

<ul>
  <li><a href="https://github.com/xmake-io/xmake/issues/786">#786</a>: 修复头文件依赖检测</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/810">#810</a>: 修复linux下gcc strip debug符号问题</li>
</ul>


        </article>
        <hr>

        <!-- baidu ads -->
        

        <!-- reward -->
        <div style="text-align: center;">
            <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
              <span>赏</span>
            </button>
            <div id="QR" style="display: none;">
                <div id="wechat" style="display: inline-block">
                  <img id="wechat_qr" src="/static/img/weixin.png" alt="WeChat Pay"/>
                  <p>微信打赏</p>
                </div>
                <div id="alipay" style="display: inline-block">
                  <img id="alipay_qr" src="/static/img/alipay.png" alt="Alipay"/>
                  <p>支付宝打赏</p>
                </div>
            </div>
        </div>

        
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
                    
                    <h2 id="english">English</h2>
                    <ul>
                    
                    <li class="relatedPost">
                        <a href="/2020/06/05/xmake-update-v2.3.4/">xmake v2.3.4 released, better toolchain support
                        
                        </a>
                    </li>
                    
                    
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
        
            </ul>
        

        
        
            
        
            
            
            
                
                    
                        
                        <h2 id="similar_posts">相关文章</h2>
                        <ul>
                        
                        <li class="relatedPost">
                            <a href="/cn/2021/12/17/xmake-update-v2.6.2/">xmake v2.6.2 发布，新增 Linux 内核驱动模块构建支持
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/cn/2021/12/03/xmake-update-v2.6.1/">xmake v2.6.1 发布，使用 Lua5.4 运行时，Rust 和 C++ 混合编译支持
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/cn/2021/10/30/xmake-update-v2.5.9/">xmake v2.5.9 发布，改进 C++20 模块，并支持 Nim, Keil MDK 和 Unity Build
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/cn/2021/10/08/xmake-update-v2.5.8/">xmake v2.5.8 发布，新增 Pascal/Swig 程序和 Lua53 运行时支持
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/cn/2021/08/29/xmake-update-v2.5.7/">xmake v2.5.7 发布，包依赖锁定和 Vala/Metal 语言编译支持
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
        
            </ul>
        

        <div class="post-recent">
    <div class="pre">

        

        

        
        
        

        

        

        
        
        <p><strong>上一篇</strong> <a href="/cn/2020/05/06/ltui-v1.7/">LTUI v1.7 发布, 一个基于lua的跨平台字符终端UI界面库</a></p>
        
    </div>

    <div class="nex">

        

        

        
        
        

        

        

        
        
        <p><strong>下一篇</strong> <a href="/cn/2020/06/28/xmake-update-v2.3.5/">xmake v2.3.5 发布, 多工具链灵活切换支持</a></p>
        
    </div>
</div>


        <h2 id="comments">评论</h2>
        






<div id="gitalk-container"></div>
<link rel="stylesheet" href="/css/gitalk.css">
<script src="/js/gitalk.min.js"></script>

<script>
const gitalk = new Gitalk({
  clientID: '73946dc1d9e2276ad0da',
  clientSecret: '12a3cb94361ba3ebc6ecb68cf80d592bfaa8106d',
  repo: 'tboox.github.io',
  owner: 'waruqi',
  admin: ['waruqi'],
  id: location.pathname,       
  language: 'zh-CN',
  distractionFreeMode: false  
})

gitalk.render('gitalk-container')
</script>





    </div>
    <button class="anchor"><i class="fa fa-anchor"></i></button>
    <div class="right">
        <div class="wrap">

            <!-- codefund ads -->
            

            <!-- Content -->
            <div class="side content">
                <div>
                    内容
                </div>
                <ul id="content-side" class="content-ul">
                    <li><a href="#english">English</a></li>
                    <li><a href="#similar_posts">相关文章</a></li>
                    <li><a href="#comments">评论</a></li>
                </ul>
            </div>


            <!-- baidu ads -->
            
            
            <br>
            <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    链接
                </div>
                <ul class="content-ul">
                  <li><a href="http://github.com/waruqi/tbox">tbox</a></li>
                  <li><a href="http://www.xmake.io">xmake</a></li>
                  <li><a href="https://github.com/waruqi">github</a></li>
                </ul>
            </div> 

            <!-- xmake courses -->
            <br>
            <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    xmake 入门课程
                </div>
                <a href="https://xmake.io/#/zh-cn/about/course" target="_blank">
                <img src="/static/img/xmake-course.png" alt="course" width="256" height="193">
                </a>
            </div>

            <!-- qqgroup -->
            <br>
            <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    技术交流群（QQ）
                </div>
                <img src="/static/img/qqgroup.png" alt="qqgroup" width="256" height="284">
            </div> 

            <!-- google ads -->
            

            <!-- baidu ads -->
            

        </div>
    </div>

    <!-- baidu ads -->
    
</div>
<script>
/**
 * target _blank
 */
(function() {
    var aTags = document.querySelectorAll('article a:not([id])')
    for (var i = 0; i < aTags.length; i++) {
        aTags[i].setAttribute('target', '_blank')
    }
}());
</script>
<script src="/js/pageContent.js " charset="utf-8"></script>



    <footer class="site-footer">
    <div class="wrapper">
        <p class="description">
             Copyright (c) 2016-2020 tboox.org 
        </p>
        <p class="contact">
            
            <a href="https://github.com/waruqi" title="GitHub"><i class="fa fa-github" aria-hidden="true"></i></a> 
             
            
            <a href="mailto:waruqi@gmail.com" title="email"><i class="fa fa-envelope-o" aria-hidden="true"></i></a> 
            
            
            <a href="https://twitter.com/waruqi" title="Twitter"><i class="fa fa-twitter" aria-hidden="true"></i></a> 
            
            <a href="/feed.xml" title="feed"><i class="fa fa-feed" aria-hidden="true"></i></a> 
        </p>
        <p class="power">
            <span>
                Site powered by <a href="https://jekyllrb.com/">Jekyll</a> & <a href="https://github.com/Gaohaoyang">HyG</a> & <a href="https://pages.github.com/">Github Pages</a>.
            </span>
        </p>
    </div>
</footer>

    <div class="back-to-top">
    <a href="#top" class="scroll">
        <i class="fa fa-arrow-up" aria-hidden="true"></i>
    </a>
</div>

    <script src=" /js/main.js " charset="utf-8"></script>
    <script src=" /js/scroll.min.js " charset="utf-8"></script>
  </body>

</html>
